package com.project.study.farming.common.entity.dto;

import lombok.Data;

@Data
public class RestOutDto<T> {

    private Integer code;

    private String msg;

    private T data;

    public static <K> RestOutDto<K> success(K t){
        RestOutDto<K> res = new RestOutDto<>();
        res.setCode(200);
        res.setData(t);
        return res;
    }

    public static <T> RestOutDto<T> fail(String msg){
        RestOutDto<T> res = new RestOutDto<>();
        res.setCode(505);
        res.setMsg(msg);
        return res;
    }
}
